The process of encryption converts ordinary information (referred to as “plaintext”) into unintelligible “ciphertext.” Decryption is the reverse process, converting ciphertext back to plaintext. Various algorithms—known as “ciphers”—are used for encryption and the reverse decryption process. The cipher uses a secret parameter, known as a “key,” in carrying out the encryption and decryption processes.
Various types of ciphers are known in the art. For example, a stream cipher is a symmetric-key cipher in which plaintext bits are combined with a stream of pseudorandom cipher bits (referred to as a “keystream”), most commonly by an exclusive-or (XOR) operation. The plaintext symbols are typically encrypted one at a time, and the transformation of successive symbols varies during the encryption.
A block cipher operates on data blocks of fixed length, such as 64 or 128 bits. There are certain standard ways, however, to build a stream cipher based on an arbitrary block cipher. For example, output feedback (OFB) mode encryption uses an encryption function E to generate a sequence of keystream blocks Oi, each based on the encryption key and on the preceding keystream block. The successive keystream blocks are XORed with the successive plaintext blocks Pi to give the ciphertext blocks Ci. Because of the symmetry of the XOR operation, encryption and decryption are exactly the same:Ci=Pi⊕Oi Pi=Ci⊕Oi Oi=EK(Oi−1)O0=IV  (1)(IV is an initialization vector, which is used to generate the first keystream block, and K is a key.)
As another example, in cipher feedback (CFB) mode, each keystream block is based on the encryption key and on the preceding ciphertext block:Ci=E(Ci−1)⊕Pi Pi=E(Ci−1)⊕Ci C0=IV  (2)
(Since the ciphertext Ci is determined by the plaintext Pi, the encryption function at any point may equivalently be framed as a function of the preceding plaintext blocks.) In this case, decryption is similar, but not identical, to the encryption operation.
In some applications, only part of a plaintext stream is encrypted, while other parts are transmitted in the clear. For example, U.S. Pat. No. 7,151,833, whose disclosure is incorporated herein by reference, describes a method of selectively encrypting and decoding digital video content. Certain packets are selected for encryption according to a selection criterion, wherein the selected packets exclude packets containing start of frame (SOF) headers. The selected packets are encrypted while retaining the packets containing the SOF headers unencrypted. In decoding the selectively-encrypted digital video content, offsets are calculated for at least one of the I frames and P frames from the SOF headers, and the calculated offsets are stored as an offset table. The offset table can then be accessed to enable trick play of the selectively-encrypted digital video content.